package common;

import android.os.Handler;


/**
 * Depiction:异步任务基类
 * <p>
 * Modify:
 * <p>
 * Author: Kevin Lynn
 * <p>
 * Create Date：2016年2月18日 下午10:57:43
 * <p>
 * 
 * @version 1.0
 * @since 1.0
 */
public abstract class AbsTask {
	protected final Handler	handler	= new Handler();
									
	private BaseActivity	act;
							
	public AbsTask() {
	}
	
	public BaseActivity getBaseActivity() {
		return act;
	}
	
	public void setBaseActivity(BaseActivity act) {
		this.act = act;
	}
	
	public void post(Runnable r) {
		handler.post(r);
	}
	
	public void postAtFrontOfQueue(Runnable r) {
		handler.postAtFrontOfQueue(r);
	}
	
	public void postAtTime(Runnable r, long uptimeMillis) {
		handler.postAtTime(r, uptimeMillis);
	}
	
	public void postAtTime(Runnable r, Object token, long uptimeMillis) {
		handler.postAtTime(r, token, uptimeMillis);
	}
	
	public void postDelayed(Runnable r, long delayMillis) {
		handler.postDelayed(r, delayMillis);
	}
	
	public abstract void excute();
	
	public abstract void onPreExecute();
	
	public abstract void onPostExecute(boolean isSuccess, Object result);
}
